import time, os

def system_sleep(delay=0):
    time.sleep(delay)  # 程序阻塞t秒
    os.system("rundll32.exe powrprof.dll,SetSuspendState Sleep")  # 控制Windows系统睡眠


def system_power_off(delay=0):
    cmd=f'shutdown -s -t '+str(delay)
    os.system(cmd)

if __name__ == '__main__':
    system_sleep()